<template>
  <div class="addfriend">
    <div style="display: flex; align-items: center">
      <img
        style="width: 50px; height: 50px; border-radius: 50%"
        :src="dataObj.avatar"
        alt=""
      />
      <div style="margin-left: 10px; font-size: 14px">
        <div class="fontcolor">{{ dataObj.nickname }}</div>
        <div class="fontcolor">{{ dataObj.username }}</div>
      </div>
    </div>
    <el-button
      v-if="dataObj.friendState == 0"
      size="small"
      type="primary"
      @click="add"
      >添加</el-button
    >
    <el-button v-else size="small" @click="send">发消息</el-button>
  </div>
</template>

<script>
export default {
  props: {
    dataObj: {
      type: Object,
      default: () => { }
    }
  },
  data() {
    return {
    }
  },
  methods: {
    send() {
      this.$emit('send', this.dataObj)
    },
    add() {
      this.$emit('add', this.dataObj, '申请添加好友')
    }
  }
}
</script>

<style lang="scss" scoped>
.addfriend {
  width: 100%;
  height: 80px;
  background: #f5f5f5;
  flex-shrink: 0;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}
</style>